package model

import (
	"gorm.io/gorm"
	"time"
)

type Goods struct {
	Id        uint           `gorm:"column:id;type:bigint(20) UNSIGNED;primaryKey;not null;" json:"id"`
	CreatedAt time.Time      `gorm:"column:created_at;type:datetime(3);not null;" json:"created_at"`
	UpdatedAt time.Time      `gorm:"column:updated_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" json:"updated_at"`
	DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:datetime(3);default:NULL;" json:"deleted_at"`
	UserId    uint           `gorm:"column:user_id;type:bigint(20) UNSIGNED;comment:用户id;not null;default:0;" json:"user_id"`           // 用户id
	GoodsName string         `gorm:"column:goods_name;type:varchar(255);comment:商品名称;not null;" json:"goods_name"`                      // 商品名称
	Price     float64        `gorm:"column:price;type:decimal(10, 2) UNSIGNED;comment:价格;not null;default:0.00;" json:"price"`          // 价格
	FileUrl   string         `gorm:"column:file_url;type:varchar(255);comment:图片地址;not null;" json:"file_url"`                          // 图片地址
	Collect   uint           `gorm:"column:collect;type:bigint(20) UNSIGNED;comment:收藏类别 1:收藏 2:取消;not null;default:0;" json:"collect"` // 收藏类别 1:收藏 2:取消
	Describe  string         `gorm:"column:describe;type:varchar(255);comment:描述;not null;" json:"describe"`                            // 描述
	Inventory uint           `gorm:"column:inventory;type:int(10) UNSIGNED;comment:库存;not null;default:0;" json:"inventory"`            // 库存
}

func (g *Goods) TableName() string {
	return "goods"
}
